<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/normalize.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/rightCon.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/thesame.css'"/>
	<link rel="stylesheet" type="text/css" th:href="@{/static/user/css/popUp.css}"/>
    <style type="text/css">
         /*取消选中效果*/
		div{
	    -moz-user-select:none;/*火狐*/
	    -webkit-user-select:none;/*webkit浏览器*/
	    -ms-user-select:none;/*IE10*/
	    -khtml-user-select:none;/*早期浏览器*/
	      user-select:none;
		}
		.admin-open nav{ padding-bottom: 50px; }
		.admin-open li{ float: left; padding: 10px; }
		.admin-open li img{ display: block; }
    </style>
</head>
<body>
<div class="right-Sidebar-con">
	<article class="mb20px">
		<div class="pad20px overflow box-shadows bgWhite border-radius5 mb20px admin-open">
			<div class="mb40px">
				<h1 class="fb mb20px">已开通功能</h1>
				<nav class="border1px pad15px cursor">
					<div th:if="${list.size()} == 0" class="darkGray">暂时还没有已开通的功能！</div>
					<h class="fb ml10px mb30px">后台</h>
					<ul class="overflow">
						<li th:id="'bg' + ${map.MENU_NO}" th:attr="data-no=${map.MENU_NO}, data-url=${map.URL}" th:each="map:${list}" th:if="${map.menu_exist == 1 && map.PLATFORM=='2'}" onclick="redirect(this)"><img th:src="@{'/static/img/'+${map.ICON}}"></li>
					</ul>
					<h class="fb ml10px mb10px">前端</h>
					<ul class="overflow">
						<li th:each="map:${list}" th:if="${map.menu_exist == 1 && map.PLATFORM=='3'}"><img th:src="@{'/static/img/'+${map.ICON}}"></li>
					</ul>
				</nav>
			</div>
			<div>
				<h1 class="fb mb20px">全部应用</h1>
				<nav class="border1px pad15px cursor">
					<h class="fb ml10px mb30px">后台</h>
					<ul class="overflow">
						<li th:if="${map.PLATFORM=='2'}" th:each="map:${list}"><img th:src="@{'/static/img/'+${map.ICON}}"></li>
					</ul>
					<h class="fb ml10px mb30px">前端</h>
					<ul class="overflow">
						<li th:if="${map.PLATFORM=='3'}" th:each="map:${list}"><img th:src="@{'/static/img/'+${map.ICON}}"></li>
					</ul>
				</nav>
			</div>
		</div>
	</article>
</div>

<script th:src="${#request.getContextPath()}+'/static/js/jquery-2.1.3.min.js'"></script>
<script th:src="${#request.getContextPath()}+'/static/layer/layer.js'"></script>
<script th:inline="javascript">var basePath = [[${#httpServletRequest.getContextPath()}]];</script>
<script>
	//跳转应用
	function redirect(obj){
  		var menuNo = $(obj).data("no");
  		var url = $(obj).data("url");
  		console.log("menuNo="+menuNo);
		console.log("url="+url);
		if(url==null||url==''||typeof url=='undefined'){
			layer.msg("暂未开放");
		}else{
			$.ajax({
				url:basePath + "/user/createToken",
				type:"post",
				dataType:"json",
				data:{"menuNo":menuNo},
				beforeSend: function(){
					$("#bg"+menuNo).css("pointer-events", "none");
				},
				success:function (result) {
					console.log("test");
					if(result.code==200){
						console.log(result);
						//跳转到子应用
						window.open(url+"?token="+result.data);
					}else{
						retFailPop("请重新登陆，session失效");
					}
					$("#bg"+menuNo).css("pointer-events", "auto");
				}
			})
		}
  	}

	/**
	 * 提示失败
	 */
	function retFailPop(msg){
	var html='<div id="pop-ret-con-fail">';
		html+='<div class="popUp" style="padding:30px;">';
		html+='<div class="delete-con">';
		html+='<dl class="textCenter">';
		html+='<dt class="mb10px"><img src="'+basePath+'/static/img/tc_icon_sb.png"></dt>';
		html+='<dd id="pop-ret-con-fail-msg" class="red">'+msg+'</dd>';
		html+='</dl>';
		html+='</div>';
		html+='</div>';
		html+='</div>';

		layer.closeAll();
		layer.open({
			type: 1
			,title: false //不显示标题栏
			,closeBtn: false
			,area: ['25%', '']
			,shade: 0.8
			,id: 'deleteFailPop' //设定一个id，防止重复弹出
			,btnAlign: 'c'
			,moveType: 1 //拖拽模式，0或者1
			,shadeClose: true //设置允许点遮罩关闭
			,content: html,
			success:function(){
			},

		});
	}
   
</script>
</body>
</html>
